import sys,os

slate_mini_dump =open('ramdump_slatefw.bin','rb')

dtcm_ram=open('DTCM_RAM.BIN','wb+')
memss=open('MEMSS.BIN','wb+')


mini_dump_size=os.path.getsize('ramdump_slatefw.bin')
if(mini_dump_size>=(48+1343488+2883584)):
    f=slate_mini_dump.read(48)
    i=0
    j=0
    while True:
        f=slate_mini_dump.read(1024)

        dtcm_ram.write(f)
        i += 1
        if(i>=1312):
            break

    while True:
        f=slate_mini_dump.read(1024)
        memss.write(f)
        j+=1
        if(j>=2816):
            break;
else:
    print('file is invalid')

memss.close()
dtcm_ram.close()
slate_mini_dump.close()

